#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define	SEL_NOTE	A
#define SEL_OCTAVE	4
#define SAMPLING_TIME	0.25
#define	SEPARATOR	'\n'
#define PI		3.14159
#define PERIOD		1/48000

typedef enum {A=0, As=1, B=2, C=3, Cs=4, D=5, Ds=6, E=7, F=8, Fs=9, G=10, Gs=11} notes_t;

const float notes_1st_octave [12]={
	27.5,
	29.13525,
	30.86775,
	32.70325,
	34.647875,
	36.708125,
	38.890875,
	41.203625,
	43.6535,
	46.24925,
	48.999375,
	51.913125
	};
	
int main (void){
	size_t i, it;
	float y, * multiplier, * percentage, f, t;
	int harmonic_qty, octave;
	notes_t note; 
	harmonic_qty=4;
	if ((multiplier=(float *)malloc(harmonic_qty*sizeof(float)))==NULL) return EXIT_FAILURE;
	if ((percentage=(float *)malloc(harmonic_qty*sizeof(float)))==NULL){
		free(multiplier);
		return EXIT_FAILURE;
	}
	it=0;
	y=0;
	note=SEL_NOTE;
	octave=SEL_OCTAVE;
	f=notes_1st_octave[note]*octave*2;
	for (i=0; i<harmonic_qty; i++){
		scanf("%f", &(multiplier[i])); /* multiplicador */
		scanf("%f", &(percentage[i])); /* porcentaje */
	}
	for (t=0; t<SAMPLING_TIME; t+=(float)PERIOD){
		for (i=0; i<harmonic_qty; i++){
			y+=percentage[i]*sin(2*PI*f*multiplier[i]*(t-it));
		}
		printf("%f", y);
		putchar(SEPARATOR);
		y=0;
	}
	free(multiplier);
	free(percentage);
	return EXIT_SUCCESS;
}
